﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kokomo.Mirror.CliMetadata.Signatures;

namespace Kokomo.Mirror.CliMetadata.Tables
{
	public class MemberRefRow : IMetadataRow
	{
		[CodedIndex(CodedIndexType.MemberRefParent)]
		public CodedIndex Class { get; set; }
		public StringRef Name { get; set; }
		[SignatureField(SignatureKind.MemberRefSig)]
		public SignatureRef Signature { get; set; }

		public override string ToString(MetadataContainer container)
		{
			IMetadataRow classRow = container.GetRow(this.Class);
			string name = container.GetString(this.Name);

			string text;
			if (classRow != null)
				text = classRow.ToString(container) + "." + name;
			else
				text = name;

			return text;
		}
	}
}
